import axios from 'axios';
import { loginreq, req, bodyreq, mlfreq } from './axiosFun';
import { getUserId } from '../utils/util';

const send = this.$http

// 用户登录接口
export const login = (params) => { return loginreq("post", "api/login", params) };
// 用户登出接口
export const logout = () => { return req("post", "/api/logout") }
// 用户基本信息接口
export const userBaseInfo = () => { return req("get", "/api/user/baseInfo") };
// docker全部信息接口
export const dockerBaseInfo = () => { return req("get", "/api/docker/baseAllInfo") }
// 获取DockerClient的具体信息
export const dockerInfoByKey = (params) => { return bodyreq("get", "/api/docker/infoById?" + params) }
// 修改DockerClient接口
export const updateDockerClient = (params) => { return bodyreq("put", "/api/docker/updateClient", params) }
// 添加DockerClient接口
export const addDockerClient = (params) => { return bodyreq("post", "/api/docker/addClient", params) }
// pingDockerClient的接口
export const pingDockerClient = (params) => { return bodyreq("post", "/api/docker/pingClient", params) }
// 删除DockerClient接口
export const deleteDockerClient = (params) => { return bodyreq("delete", "/api/docker/deleteClient", params) }
// 获取全部Container接口
export const getAllContainer = () => { return req("get", "/api/container/getAll") }

// 开启Container接口
export const startContainer = (params) => { return bodyreq("post", "/api/container/startContainer", params) }
// 停止Container接口
export const stopContainer = (params) => { return bodyreq("post", "/api/container/stopContainer", params) }
// 暂停Container接口
export const pauseContainer = (params) => { return bodyreq("post", "/api/container/pauseContainer", params) }
// 取消暂停Container接口
export const unpauseContainer = (params) => { return bodyreq("post", "/api/container/unpauseContainer", params) }
// 重命名Container接口
export const renameContainer = (params) => { return bodyreq("post", "/api/container/renameContainer", params) }
// 删除Containaer容器
export const removeContainer = (params) => { return bodyreq("post", "/api/container/removeContainer", params) }
// 获取Container具体信息接口
export const infoContainer = (params) => { return bodyreq("post", "/api/container/infoById", params) }

// 人脸识别登录接口
export const loginByFace = (params) => { return loginreq("post", "/loginByFace", params) };
// 用户修改信息接口
export const userInfoUpdate = (params) => { return bodyreq("post", "/api/user/updateInfo", params) };
// 用户修改头像接口
export const userAvatarUpdate = (params) => { return mlfreq("post", "/api/user/uploadAvatar", params) }
// 用户打卡任务信息接口
export const clockingTaskInfo = (params) => { return req("get", "/api/log/" + params).then(res => res.data) }
// 用户打卡
export const clockingTaskLog = (params) => { return req("post", "/api/log/userLog", params) }
// 用户查看请假信息
export const vacationInfo = (params) => { return req("get", "/api/vacation/" + params, "").then(res => res.data) }
// 用户申请请假
export const userVacated = (params) => { return bodyreq("post", "/api/vacation/vacated", params) }
// 用户查看公告
export const announcementInfo = (params) => { return req("get", "/api/announcement/info/" + params, "").then(res => res.data) }
// 用户查看详细公告
export const announcementOneInfo = (params) => { return req("get", "/api/announcement/" + params, "").then(res => res.data) }


// 部门主管获取部门信息
export const groupBaseInfo = (params) => { return req("get", "/api/group/groupInfo/" + params, "").then(res => res.data) }
// 部门主管获取部门成员信息
export const groupMembersInfo = (params) => { return req("get", "/api/group/groupMembers/" + params, "").then(res => res.data) }
// 主管获取部门请假信息
export const vacationsGroupInfo = (params) => { return req("get", "/api/vacation/listGroup" + params, "").then(res => res.data) }
// 部门主管修改信息
export const groupInfoUpdate = (params) => { return bodyreq("post", "/api/group/updateInfo", params) }
// 主管录入人员人脸信息
export const groupAddFace = (params) => { return mlfreq("post", "/api/face/add", params) }
// 主管发布打卡任务
export const clockingAdd = (params) => { return req("post", "/api/log/add", params) }
// 主管修改打卡任务
export const clockingUpdate = (params) => { return req("post", "/api/log/updateLog", params) }
// 主管发布公告
export const announcementsAdd = (params) => { return bodyreq("post", "/api/announcement/addAnnouncements", params) }
// 主管修改公告
export const annoucnementsUpdate = (params) => { return bodyreq("post", "/api/announcement/updateAnnouncements", params) }

// 管理员获取信息
export const adminBaseInfo = (params) => { return req("get", "/api/user/adminInfo/" + params, "") };
// 管理员获取全部用户信息
export const userAllInfo = (params) => { return req("get", "/api/user/list" + params, "").then(res => res.data) }
// 管理员添加用户
export const userAdd = (params) => { return bodyreq("post", "/api/user/addUser", params) }
// 管理员重置用户密码
export const userPasswordReset = (params) => { return req("post", "/api/user/resetUserPassword", params) }
// 管理员获取全部部门信息
export const groupAllInfo = (params) => { return req("get", "/api/group/list" + params, "").then(res => res.data) }
// 管理员添加部门
export const groupAdd = (params) => { return bodyreq("post", "/api/group/addGroup", params) }
// 管理员修改部门
export const groupUpdate = (params) => { return bodyreq("post", "/api/group/updateGroup", params) }
// 管理员获取部门下人员信息
export const groupMember = (params) => { return req("post", "/api/group/getGroupMembers", params) }
// 管理员设置部门的管理员
export const groupSetAdmin = (params) => { return req("post", "/api/group/setGroupAdmin", params) }
// 管理员获取全部打卡任务信息
export const clockingTaskAllInfo = (params) => { return req("get", "/api/log/list" + params, "").then(res => res.data) }
// 管理员发布打卡任务
export const clockingTaskAdd = (params) => { return bodyreq("post", "/api/log/addLog", params) }
// 管理员获取全部请假信息
export const vacationsAllInfo = (params) => { return req("get", "/api/vacation/list" + params, "").then(res => res.data) }
// 管理员操作请假
export const vacationsChange = (params) => { return req("post", "/api/vacation/changeVacation", params) }
// 管理员获取全部公告信息
export const announcementAllInfo = (params) => { return req("get", "/api/announcement/list" + params, "").then(res => res.data) }
// 管理员发布公告
export const announcementAdd = (parmas) => { return bodyreq("post", "/api/announcement/addAnnouncement", parmas) }
// 管理员修改公告
export const announcementChange = (parmas) => { return bodyreq("post", "/api/announcement/updateAnnouncement", parmas) }

// 管理员获取全部部门分类
export const groupNameAll = (parmas) => { return req("get", "/api/group/groupName", "").then(res => res.data) }


// 获取用户菜单
export const menu = (params) => { return axios.get("/api/menu?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 退出接口
export const loginout = () => { return axios.delete("/api/login?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

/**
 * 用户管理
 **/
// 用户管理-获取用户列表
export const userList = (params) => { return req("post", "/api/User/list", params) };
// 用户管理-保存（添加编辑）
export const userSave = (params) => { return req("post", "/api/User/save", params) };
// 用户管理-删除用户
export const userDelete = (params) => { return axios.delete("/api/User/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 用户管理-重置密码
export const userPwd = (params) => { return req("post", "/api/User/pwd", params) };
// 用户管理-修改状态
export const userLock = (params) => { return axios.get("/api/User/lock?userId=" + params.userId + "&lock=" + params.lock + "&token=" + localStorage.getItem('logintoken')) };
// 用户管理-数据权限
export const UserDeptTree = (params) => { return axios.get("/api/UserDept/tree/" + params + "?token=" + localStorage.getItem('logintoken')) };
// 用户管理-数据权限保存
export const UserDeptSave = (params) => { return req("post", "/api/UserDept/save", params) };
// 用户管理-获取部门设置
export const UserDeptdeptTree = (params) => { return axios.get("/api/UserDept/deptTree/" + params + "?token=" + localStorage.getItem('logintoken')) };
// 用户管理-保存部门设置
export const UserChangeDept = (params) => { return req("post", "/api/User/change/dept", params) };
// 用户管理-用户下线
export const userExpireToken = (params) => { return req("get", "/api/User/expireToken/" + params, {}) };
// 用户管理-刷新缓存
export const userFlashCache = (params) => { return req("get", "/api/User/flashCache/" + params, {}) };

/**
 * 菜单管理
 **/
// 菜单管理-获取菜单Module/list
export const ModuleList = () => { return req("post", "/api/Module/list") };
// 菜单管理-根据菜单获取数据
export const ModuleGet = (params) => { return axios.get("/api/Module/get/" + params + "?token=" + localStorage.getItem('logintoken')) };
// 菜单管理-获取父级菜单Module/nodes
export const ModuleNodes = (params) => { return req("post", "/api/Module/nodes", params) };
// 菜单管理-修改菜单
export const ModuleSave = (params) => { return req("post", "/api/Module/save", params) };
// 菜单管理-删除菜单
export const ModuleDelete = (params) => { return axios.delete("/api/Module/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

/**
 * 角色管理
 **/
// 角色管理-获取角色列表
export const roleList = (params) => { return req("post", "/api/Role/list", params) };
// 角色管理-保存（添加编辑）
export const roleSave = (params) => { return req("post", "/api/Role/save", params) };
// 角色管理-删除角色
export const roleDelete = (params) => { return axios.delete("/api/Role/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 角色管理-菜单权限（获取）
export const RoleRightTree = (params) => { return axios.get("/api/RoleRight/tree/" + params + "?token=" + localStorage.getItem('logintoken')) };
// 角色管理-菜单权限（保存）
export const RoleRightSave = (params) => { return req("post", "/api/RoleRight/save", params) };

/**
 * 公司管理
 **/
// 公司管理-获取公司列表
export const deptList = (params) => { return req("post", "/api/Dept/list", params) };
// 公司管理-保存（添加编辑）
export const deptSave = (params) => { return req("post", "/api/Dept/save", params) };
// 公司管理-删除公司
export const deptDelete = (params) => { return axios.get("/api/Dept/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

/**
 * 系统环境变量
 **/
// 系统环境变量-获取系统环境变量列表
export const variableList = (params) => { return req("post", "/api/Variable/list", params) };
// 系统环境变量-保存（添加编辑）
export const variableSave = (params) => { return req("post", "/api/Variable/save", params) };
// 系统环境变量-删除系统环境变量
export const variableDelete = (params) => { return axios.delete("/api/Variable/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

/**
 * 权限管理
 **/
// 权限管理-获取权限列表
export const permissionList = (params) => { return req("post", "/api/Permission/list", params) };
// 权限管理-保存权限
export const ermissionSave = (params) => { return req("post", "/api/Permission/save", params) };
// 权限管理-删除权限
export const ermissionDelete = (params) => { return axios.delete("/api/Permission/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 权限管理-获取权限
export const roleDropDown = () => { return axios.get("/api/Role/dropDown/all?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 权限管理-配置权限
export const RolePermission = (params) => { return req("post", "/api/RolePermission/save", params) };
